package com.martin.study.create_instance.test;

import com.martin.study.create_instance.bean.ApplicationConfig;
import com.martin.study.create_instance.bean.Emp;
import com.martin.study.create_instance.bean.Org;
import org.springframework.beans.factory.annotation.AnnotatedGenericBeanDefinition;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.stereotype.Component;

@Component
public class ConstructorChooseBean {

	@Autowired
	private Emp emp;

	@Autowired
	private Org org;


	public ConstructorChooseBean() {
		System.out.println("无参构造函数被调用");
	}

	@Autowired(required = false)
	public ConstructorChooseBean(Emp emp) {
		System.out.println("单参数构造函数被调用，参数是Emp");
		this.emp = emp;
	}

	@Autowired(required = false)
	public ConstructorChooseBean(Org org) {
		System.out.println("单参数构造函数被调用，参数是Org");
		this.org = org;
	}

	@Autowired(required = false)
	public ConstructorChooseBean(Emp emp, Org org) {
		System.out.println("双参数构造函数被调用，参数是Emp、Org");
		this.emp = emp;
		this.org = org;
	}

	@Autowired(required = false)
	public ConstructorChooseBean(Emp emp, Org org, @Value("test")String str) {
		System.out.println("三参数构造函数被调用，参数是Emp、Org、str");
		System.out.println(str);
		this.emp = emp;
		this.org = org;
	}
}
